﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Employee/Employee.master" AutoEventWireup="true" CodeBehind="empList.aspx.cs" Inherits="HRdex_Final.Employee.WebForm1" %>
<asp:Content ID="EmpListContent" ContentPlaceHolderID="MainContent" runat="server">
    
    <div align="center">
    
        <asp:DropDownList ID="ddlsrch" runat="server">
            <asp:ListItem>Name</asp:ListItem>
            <asp:ListItem>Employee No.</asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="txtsrch" runat="server"></asp:TextBox>
        <asp:Button ID="btnsrch" runat="server" onclick="btnsrch_Click" Text="Search" />
    
    <asp:GridView ID="gvEmpList" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="EmployeeID" DataSourceID="EmpList" style="text-align: left" 
        onselectedindexchanged="Emp" AllowPaging="True" BackColor="White" 
            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
            Width="700px">
        <Columns>
<asp:TemplateField>
<ItemTemplate> 
<asp:HyperLink ID="lnkSelect" runat='server' NavigateUrl='<%# String.Format("~/Employee/EmpForm.aspx?EmployeeID={0}", Eval("EmployeeID")) %>'>Select</asp:HyperLink> 
</ItemTemplate> 
    <ItemStyle Width="40px" />
</asp:TemplateField>
        <asp:BoundField DataField="EmployeeID" HeaderText="Employee No" ReadOnly="True" 
            SortExpression="EmployeeID" Visible="False" />
        <asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" 
            SortExpression="Name" >
            <ItemStyle Width="180px" />
            </asp:BoundField>
        <asp:BoundField DataField="Position" HeaderText="Position" 
            SortExpression="Position" />
        <asp:BoundField DataField="Department" HeaderText="Department" 
            SortExpression="Department" />
        <asp:BoundField DataField="Contact No" HeaderText="Contact No" 
            SortExpression="Contact No" />
        <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
    </Columns>
        <FooterStyle BackColor="White" ForeColor="#000066" />
        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
        <RowStyle ForeColor="#000066" />
        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#007DBB" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#00547E" />
    </asp:GridView>
<asp:SqlDataSource ID="EmpList" runat="server" 
    ConnectionString="<%$ ConnectionStrings:HRmainConnectionString %>" 
    
        SelectCommand="SELECT formEmployees.EmployeeID, formEmployees.LastName + ', ' + formEmployees.FirstName + ' ' + formEmployees.MiddleName AS Name, catPositions.catPositionsName AS Position, catDepartment.DepartmentName AS Department, formEmployees.ContactNo AS [Contact No], formEmployees.Email FROM formEmployees INNER JOIN catPositions ON formEmployees.catPositionsID = catPositions.catPositionsID INNER JOIN catDepartment ON formEmployees.DeptID = catDepartment.DeptID">
</asp:SqlDataSource>


</div>
</asp:Content>